require("doRedis")

registerDoRedis("jobs")
startLocalWorkers(n=4, queue="jobs", timeout=1)
cat("Workders started.\n")
start <- Sys.time()
x <- foreach(j=1:4, .combine=sum, .verbose=TRUE, 
             .options.redis=list(ftinterval=5, chunkSize=2)) %dopar%
{
  if(difftime(Sys.time(), start) < 5) quit(save="no")
  j
}

removeQueue("jobs")
